#ifndef __mystruct_h_
#define __mystruct_h_

#include "qtapi.h"
#include "ThostFtdcUserApiStruct.h"


struct CtpOrderField: public OrderField{
	char UserOrderLocalID[21];
	char BrokerID[8];
	char UserID[12];
	char InvestorID[12];

	bool Frozened;
	bool Restored;
	int  TradedVolume;

	time_t  CancelTime;
	bool	SysReturned;
	bool	CtpReturned;
	int 	Stage1;
	int 	Stage2;
	int 	Stage3;
	int 	Canceling;

	CThostFtdcInputOrderField* pInputOrderField;

	CtpOrderField(){
		memset(this,0,sizeof(CtpOrderField));
	}
};

struct  PositionField{
	char	InstrumentID[32];
	int		LongVolume;
	int		LongTodayVolume;
	int		LongTotalClosable;
	int		LongTodayClosable;
	double  LongTodayAmmount;
	double  LongYdAmmount;

	int		ShortVolume;
	int		ShortTodayVolume;
	int		ShortTotalClosable;
	int		ShortTodayClosable;
	double  ShortTodayAmmount;
	double  ShortYdAmmount;
	
	double  LastPrice;

	bool	IsSHFE;
};

struct  PositionDetailField{
	char	InstrumentID[32];
	int		Volume;
	int		ClosedVolume;
	char	Direction;
	char	OpenDate[12];
	char	TradeID[32];
	double	OpenPrice;
	double	PositionPrice;
	bool	IsCom;
	bool	IsToday;
};

struct InstrumentField{
	CThostFtdcInstrumentField CtpIns;
	int nID;
};

struct CThostFtdcDepthMarketDataField2
{
	CThostFtdcDepthMarketDataField CtpMD;


	int 		Multiply;

	double 		PriceTick;

	int			nID;

	bool		IsCECZ;
};

struct TimerArgs 
{
	IPolicy* policy;
	int millisec;
	OrderField* pOrder;
};

#endif
